﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BUS;
using DAO;

namespace FDeal.WUC
{
    public partial class ThongTinChiTiet1 : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadDSChiTiet();
            }
        }

        private void LoadDSChiTiet()
        {
            ChiTietDealBUS chiTietDealBUS = new ChiTietDealBUS();
            List<CHITIETDEAL> dsChiTietDeal = chiTietDealBUS.Lay4ChiTietBatKi();

            foreach (CHITIETDEAL ct in dsChiTietDeal)
            {
                if (ct.TIEUDE.Length > 20)
                    ct.TIEUDE = ct.TIEUDE.Substring(0,17) + "...";
                if (ct.TOMTATDEAL.Length > 170)
                    ct.TOMTATDEAL = ct.TOMTATDEAL.Substring(0, 167) + "...";
            }

            dlChiTiet.DataSource = dsChiTietDeal;
            dlChiTiet.DataBind();
        }
    }
}